package org.shangma.controller;

import org.shangma.common.Good;
import org.shangma.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("good")
public class GoodController {

    @Autowired
    private GoodService goodServcie;

    @GetMapping("{id}")
    public Good findById(@PathVariable("id") int id){
        return goodServcie.findGoodById(id);
    }

    @PutMapping()
    public void reduceStock(int goodId,int stockNum){
        goodServcie.reduceStock(goodId,stockNum);
    }
}
